package edu.tgc.web.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import edu.tgc.service.system.SysDeptService;

@Controller
public class MainController {

    @Autowired
    private SysDeptService sysDeptService;

    @RequestMapping(value = "login", method = RequestMethod.GET)
    public String login(HttpSession session) {
        // boolean allowed = defaultWebInvocationPrivilegeEvaluator.isAllowed("/class", securityContext.getAuthentication());
        // System.out.println(allowed);
        // session.setAttribute("captcha", "12");
        return "main/login";
    }

    @RequestMapping(value = "main", method = RequestMethod.GET)
    public String main(Model model) {
        model.addAttribute("list", this.sysDeptService.getList());
        return "main/main";
    }

    /*    @RequestMapping(value = "test")
    public Object test() {
        CommonCrudService bean = this.applicationContext.getBean(this.baseService.getClass());
        System.out.println(bean == null);
        return "啊啊";
    }

        @ResponseBody
        @RequestMapping(value = "test1")
        public Object toExcel1() {

            List<SysUser> data = baseService.getList();
            return ExcelView.build("工作簿名", "工作表名", data, new SysUserWrapper());
        }

        @ExcelViewResponseBody(workbookName = "工作簿名", sheetName = "工作表名", dataWrapperClass = SysUserWrapper.class)
        @RequestMapping(value = "test2")
        public Object toExcel2() {
            List<SysUser> data = baseService.getList();
            return data;
        }*/
}
